package com.depin.pdaapp.presenter;

import com.depin.pdaapp.bean.UserBean;
import com.depin.pdaapp.http.NetBiz;
import com.depin.pdaapp.utils.RxSubscriber;
import com.jaydenxiao.common.base.BasePresenter;
import com.jaydenxiao.common.basebean.BaseRespose;
import com.vondear.rxtool.view.RxToast;

/**
 * Created by 哼哼
 * Date：2020/8/9 12:19
 * Desc:
 */
public class ScaninPresenter extends BasePresenter<ScaninPresenter.View> {
    public interface View {
        void ScanIn(BaseRespose baseRespose);
    }

    public void ScanIn(String qrcode, String in_time, String in_address) {
        mRxManage.add(new NetBiz().ScanIn(qrcode, in_time, in_address).subscribe(new RxSubscriber<BaseRespose>(mContext) {
            @Override
            protected void _onNext(BaseRespose baseRespose) {
                mView.ScanIn(baseRespose);
            }

            @Override
            protected void _onError(String message) {
                RxToast.showToast(message);
            }
        }));
    }

    public void ScanOut(String qrcode, String in_time, String in_address) {
        mRxManage.add(new NetBiz().ScanOut(qrcode, in_time, in_address).subscribe(new RxSubscriber<BaseRespose>(mContext) {
            @Override
            protected void _onNext(BaseRespose baseRespose) {
                mView.ScanIn(baseRespose);
            }

            @Override
            protected void _onError(String message) {
                RxToast.showToast(message);
            }
        }));
    }


}